class Recipe < ActiveRecord::Base
  
  validates :name, :presence => true
  
  has_attached_file :picture, :styles => { :medium => "300x300>", :thumb => "100x100>" } 
  attr_accessor :delete_picture
  before_validation { self.picture.clear if self.delete_picture == '1' }
 
  has_many :recipes_courses
  has_many :courses, :through=>:recipes_courses
  
  has_many :food_types_recipes
  has_many :food_types, :through=>:food_types_recipes
  
  has_many :steps
  
   
end
